home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1997 / MacHack 1997.toast / Hacks / Hacks ’97 / Warrior’s Progress / source code / Source / Libraries / Application / WindowLocator.cp < prev    next >
Encoding:
Text File  |  1997-06-28  |  698 b   |  36 lines  |  [TEXT/CWIE]

  1. // WindowLocator.cp
  2.  
  3. #ifndef WindowLocator_h
  4. #include "WindowLocator.h"
  5. #endif
  6. #ifndef StrangeWindow_h
  7. #include "StrangeWindow.h"
  8. #endif
  9. #ifndef RedBlackLinkTree_h
  10. #include "RedBlackLinkTree.h"
  11. #endif
  12.  
  13. WindowLocator::TreeType& WindowLocator::Tree()
  14.   {
  15.     static TreeType tree;
  16.     return tree;
  17.   }
  18.  
  19. void WindowLocator::Register( Registration& registation )
  20.   {
  21.     Tree().Add( registation );
  22.   }
  23.  
  24. AbstractWindow& WindowLocator::LocateWindow( WindowPtr theWindow )
  25.   {
  26.     Registration *registration = Tree().Find( theWindow );
  27.     if ( registration != 0 )
  28.         return **registration;
  29.     
  30.     static StrangeWindow strange( 0 );
  31.     strange = StrangeWindow( theWindow );
  32.     return strange;
  33.   }
  34.  
  35. #include "RedBlackLinkTree.cp"
  36.